<?php
	require_once("include/jara_fns.php");
	try {
		$id = $_REQUEST["id"];
		$result = jara_db_query("select * from jara_pages where id = '$id' limit 1");
		if($result->num_rows == 0) {
			throw new JaraGeneralException("The specified page does not exist.");
		}
		$row = $result->fetch_assoc();
		jara_page_start($row["title"]);
		echo $row["text"];
		jara_page_end();
	}
	catch(JaraDatabaseException $ex) {
		jara_page_start("Database error");
?>
<p>
	A database error occured during the process of creating this page.
</p>
<p>
	Error type: <?php echo (($ex->getSqlStage() == 1) ? "MySQL connection error" : "MySQL query error"); ?><br />
	Error message: &quot;<?php echo $ex->getSqlMsg(); ?>&quot; [code <?php echo $ex->getSqlCode(); ?>]
</p>
<?php
		jara_page_end();
		exit;
	}
	catch(JaraGeneralException $ex) {
		jara_page_start("General error");
?>
<p>
	A general error occured during the process of creating this page.
</p>
<p>
	<?php echo $ex->getMessage(); ?>
</p>
<?php
		jara_page_end();
		exit;
	}
?>